#ifndef _REQUEST_H_
#define _REQUEST_H_

#include <map>
#include <vector>
#include <stdexcept>
// #include <boost/algorithm/string.hpp>
// #include <boost/algorithm/string_regex.hpp>

#include "connector.h"
#include "util.h"

namespace dxy::easyWebServer
{

class Request
{
public:
    Request(int fd);
    ~Request();

    void parse();

    std::string & get(const std::string & src);

    void set(const std::string & key, const std::string & value);


private:
    void parseHead(const std::string & src);
    void parseMsg(const std::string & src);
    
public:
    uint8_t                                         m_body[1024];
    std::string                                     m_version;
    std::string                                     m_method;
    std::string                                     m_url;
    Connector                                       m_conn;
private:
    std::map<std::string, std::string>              m_ctx;
    int                                             m_cliFd = -1;
    
};

}


#endif